<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ include file="../include/admincontent.jsp" %>
<div id="Content">
    <form id="modelform" method="post" action="/Project/PubAction">
<%--       <div class="btnbar">
            <button type="submit" class="save">保 存</button>
        </div>--%>

        <div class="toolbars" style="height:30px;white-space:nowrap;width:auto;margin-left: 5px;" totalwidth="314">
            <a id="btn_project_pub_save">
                <em  class="ico16 save_traft_16"></em>
                <span class="menu_span" title="保存" lay-submit=""  lay-filter="btn_project_save" >保存</span>
            </a>
        </div>

<%--        <div class="help">${project}</div>--%>
        <table class="treeTable inputform" style="margin-top: 20px">
            <tbody>
            <tr>
                <td width="80" style="text-align: center">招聘计划：</td>
                <td id="zpPlanName"></td>
            </tr>
            <tr>
                <td width="80" style="text-align: center">招聘方案：</td>
                <td id="zpPName"></td>
            </tr>
            <tr>
                <td width="80" style="text-align: center">招聘方式：</td>
                <td id="zpRecruittype"></td>
            </tr>
            <tr>
<%--                <td width="80" style="text-align: center">时间范围：</td>--%>
<%--                <td>--%>
<%--&lt;%&ndash;                    <div><input type="text" name="startdate" datatype="*" nullmsg="开始时间不能为空！" class="select"&ndash;%&gt;--%>
<%--&lt;%&ndash;                                onFocus="blur()"&ndash;%&gt;--%>
<%--&lt;%&ndash;                                onclick="laydate({istime: false, format: 'YYYY-MM-DD',min:'${today}'})"/></div>&ndash;%&gt;--%>
<%--                    &lt;%&ndash;<div class="layui-input-inline">--%>
<%--                        <input class="layui-input" id="sData" type="text" style="height: 30px;width: 200px" placeholder="开始 到 结束">--%>
<%--                    </div>&ndash;%&gt;--%>
<%--                </td>--%>
<%--            </tr>--%>

           <tr>
                <td width="80" style="text-align: center">开始时间：</td>
                <td>
                    <div><input type="text" name="startdate" datatype="*" nullmsg="开始时间不能为空！" class="select"
                                onFocus="blur()"
                                onclick="laydate({istime: false, format: 'YYYY-MM-DD',min:'${today}'})"/></div>
                </td>
            </tr>
            <tr>
                <td width="80" style="text-align: center">截止时间：</td>
                <td>
                    <div><input type="text" name="enddate" datatype="*" nullmsg="截止时间不能为空！" class="select"
                                onFocus="blur()"
                                onclick="laydate({istime: false, format: 'YYYY-MM-DD',min:'${today}'})"/></div>
                </td>
            </tr>
            </tbody>
        </table>

    </form>
</div>
<script type="text/javascript">

    var urlGetID = GetQueryString("id");
    var urlData = '/Project/getPubJson' +'?&id='+urlGetID;

    var initData = initialdata();

    function initialdata(){
        $.ajax({
            type : "POST",
            url: urlData,
            dataType: "json",
            success: function (data) {
                //console.log(data);
                $("#zpPlanName").text(data.data.zpPlanName);
                $("#zpPName").text(data.data.zpPName);
                $("#zpRecruittype").text(data.data.zpRecruittype);
            }
        })
    }

    var nowDates =
        layui.use('util', function(){
        var util = layui.util;
        nowDates = util.toDateString(new Date(), 'yyyy-MM-dd');//获取当前日期
    });



    layui.use('util', function(){
        var util = layui.util;
        nowDates = util.toDateString(new Date(), 'yyyy-MM-dd');//获取当前日期
    });

  /*  layui.use('laydate', function(){
        var laydate = layui.laydate;
        laydate.render({
            elem: '#sData'
            ,type: 'datetime'
            ,range: '到'
            ,format: 'yyyy-M-d'
          //  ,min: nowDates //设定最小日期为当前日期
            ,done: function(value, date, endDate){
                startDatas = getDates(date);
                endDates = getDates(endDate);
            }
        });
    });*/

    /**
     * 时间转换
     * @param dateTmep
     * @returns {*}
     */
    function getDates(dateTmep) {
        var dTemps;
        dTemps = dateTmep.year.toString();
        if(dateTmep.month<10)
            dTemps = dTemps+"-0"+dateTmep.month.toString();
        else
            dTemps = dTemps+"-"+dateTmep.month.toString();
        if(dateTmep.date<10)
            dTemps = dTemps+"-0"+dateTmep.date.toString();
        else
            dTemps = dTemps+"-"+dateTmep.date.toString();

        return dTemps;
    }
   // upProjectPubFlag = false;
    /**
     * 判断时间不为空，则保存
     */
    $("#btn_project_pub_save").click(function () {
        var startDatas =  $('#modelform input[name=startdate]').val();
        var endDates=  $('#modelform input[name=enddate]').val();
       if((startDatas!=null)&&(endDates!=null)){
           var urlDat = '/Project/PubActions' +'?&id='+urlGetID+'&startdate='+startDatas+'&enddate='+endDates;
          $.ajax({
              type : "POST",
              url: urlDat,
              dataType: "json",
              success: function (data) {
               //   upProjectPubFlag = data.state;
                  if(data.state)
                      layer.msg(data.Message,{icon:1});
                  else
                      layer.msg(data.Message,{icon:2});
              }
          })
      }
      // }else{
      //     layer.msg("时间范围不能为空！",{icon:2});
      // }
    });

</script>
</body>
</html>